
<%@page import="java.util.List"%>
<%@page import="com.garagesale.data.User"%>
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>

<!-- The following page directive is needed for c:out to work properly.. otherwise,  -->
<!-- you get the following error: "According to TLD or attribute directive in tag file, attribute var does not accept any..." -->


<%@include file="/WEB-INF/jspf/tagImports.jspf" %>

<html:html lang="true">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>
            Welcome Admin
        </title>
        <html:base/>
    </head>

    <tags:adminMenu />

    <div id="content">
        <tags:body>
            <logic:notPresent name="org.apache.struts.action.MESSAGE" scope="application">
                <div  style="color: red">
                    ERROR:  Application resources not loaded -- check servlet container
                    logs for error messages.
                </div>
            </logic:notPresent>


            <h2>Users:</h2>
            <table style="border-style: solid;">
                <tr style="border-style: inherit;">
                    <th>First Name</th>
                    <th>Last Name</th>
                    <th>Username</th>
                    <th>Email Address</th>
                </tr>
                <c:forEach var="user" items="${users}" >
                    <tr>
                        <td><c:out value="${user.firstName}" /></td>
                        <td><c:out value="${user.lastName}" /></td>
                        <td><c:out value="${user.username}" /></td>
                        <td><c:out value="${user.emailAddress}" /></td>
                    </tr>
                </c:forEach>
            </table>


            <h2>Categories:</h2>
            <table style="border-style: solid;">
                <tr style="border-style: inherit;">
                    <th>Name</th>
                    <th>Color</th>
                </tr>
                <c:forEach var="category" items="${categories}" >
                    <tr>
                        <td><c:out value="${category.name}" /></td>
                        <td style="background-color: ${category.labelColor};"><c:out value="${category.labelColor}" /></td>
                    </tr>
                </c:forEach>
            </table>

            <h2>Administrators:</h2>
            <table style="border-style: solid;">
                <tr style="border-style: inherit;">
                    <th>UserName</th>
                    <th>Password</th>
                    <th>Email</th>
                </tr>
                <c:forEach var="administrator" items="${admin}" >
                    <tr>
                        <td><c:out value="${administrator.username}" /></td>
                        <td><c:out value="${administrator.password}" /></td>
                        <td><c:out value="${administrator.emailAddress}" /></td>
                    </tr>
                </c:forEach>
            </table>

            <br />

            <h2>All Items in the system:</h2>
            <table style="border-style: solid;">
                <tr style="border-style: inherit;">
                    <th>Name</th>
                    <th>Description</th>
                    <th>Price</th>
                    <th>category</th>
                </tr>
                <c:forEach var="item" items="${allItems}" >
                    <tr>
                        <c:url var="viewItemUrl" value="/user/viewItem.do">
                            <c:param name="itemID" value="${item.itemID}" />
                        </c:url>
                        <td><c:out value="${item.name}" /></td>
                        <td><c:out value="${item.description}" /></td>
                        <td><c:out value="${item.salePrice}" /></td>
                        <td style="background-color: ${item.itemCategory.labelColor};"><c:out value="${item.itemCategory.name}" /></td>
                    </tr>
                </c:forEach>
            </table>

        </tags:body>
    </div>
    <div id = "footer">
        <span>
            &nbsp;All rights reserved Garage Sale 2011 | Legal | Privacy Policy
        </span>
        <br><br>
        <img alt="" src="images/b1.gif">
        <img alt="" src="images/b2.gif" style="margin:0px 5px 0px 5px">
        <img alt="" src="images/b3.gif">
    </div>
</html:html>
